<template>
  <div class="categories">
    <Header :headerInfo="{pageTitle}"/>
    <div class="container-md d-flex justify-content-between my-5" id="main">
      <div class="content">
        <div id="cates">
          <h2 class="text-center">分类 - 3</h2>
          <ul class="cate-list">
            <li>
              <span class="round iconfont icon-round"></span>
              <nuxt-link to="#">html</nuxt-link>
              <span class="art-num">(4)</span>
            </li>
            <li>
              <span class="round iconfont icon-round"></span>
              <nuxt-link to="#">css</nuxt-link>
              <span class="art-num">(4)</span>
            </li>
            <li>
              <span class="round iconfont icon-round"></span>
              <nuxt-link to="#">javascript</nuxt-link>
              <span class="art-num">(4)</span>
            </li>
          </ul>
        </div>
        <div id="tags">
           <h2 class="text-center">标签 - 8</h2>
           <ul class="tags-list">
             <li v-for="(item,index) in tags" :key="index" :style="{background:randomRgbColor()}">
                <nuxt-link to="#" :title="item">{{item}}</nuxt-link>
             </li>
           </ul>
        </div>
      </div>
      <AsideContent/>
    </div>
    <Footer/>
  </div>
</template>

<script>
export default {
  data() {
    return {
      pageTitle:"分类与标签",
      tags:['js','html','css','ui','linux','自定义']
    }
  },
  methods:{
    randomRgbColor() { //随机生成RGB颜色
      var r = Math.floor(Math.random() * 256); //随机生成256以内r值
      var g = Math.floor(Math.random() * 256); //随机生成256以内g值
      var b = Math.floor(Math.random() * 256); //随机生成256以内b值
      return `rgb(${r},${g},${b})`; //返回rgb(r,g,b)格式颜色
    }
  }
}
</script>

<style>
  .cate-list li {
    padding: 4px 0;
  }
  .cate-list li .round {
    color: var(--primary);
    font-size: 14px;
  }
  .cate-list li:hover .round{
    color: var(--primary-hover-color);
  }
  .cate-list li a {
    margin: 0 4px 0 4px;
    color: var(--base-text-color);
  }
  .cate-list li a:hover  {
    color: var(--primary);
  }
  .cate-list li .art-num {
    color: #999;
  }
  #tags {
    margin-top: 50px;
  }
  .tags-list {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
  }
  .tags-list li {
    padding: 3px 12px;
    margin: 6px;
    background: var(--primary);
    border-radius: 0.5rem;
  }
  .tags-list li a {
    color: #fff;
  }
</style>